-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatic access verification for AOAI services to develop and run on CAPI/managed AI resources #2764
base: main
Are you sure you want to change the base?
Conversation
…erification for AOAI services to develop and run on CAPI/managed AI resources
…ces using new method
…ess-verification-rebranch
…access-verification-rebranch
…access-verification-rebranch
…rganized function
src/System Application/App/AI/src/Azure OpenAI/AOAIAuthorization.Codeunit.al
Show resolved
Hide resolved
src/System Application/App/AI/src/Azure OpenAI/AOAIAuthorization.Codeunit.al
Show resolved
Hide resolved
src/System Application/App/AI/src/Azure OpenAI/AzureOpenAI.Codeunit.al
Outdated
Show resolved
Hide resolved
src/System Application/App/AI/src/Azure OpenAI/AOAIAuthorization.Codeunit.al
Outdated
Show resolved
Hide resolved
src/System Application/App/AI/src/Azure OpenAI/AOAIAuthorization.Codeunit.al
Outdated
Show resolved
Hide resolved
src/System Application/App/AI/src/Azure OpenAI/AOAIAuthorization.Codeunit.al
Outdated
Show resolved
Hide resolved
src/System Application/App/AI/src/Azure OpenAI/AOAIAccountVerificationLog.Table.al
Outdated
Show resolved
Hide resolved
src/System Application/App/AI/src/Azure OpenAI/AOAIAuthorization.Codeunit.al
Show resolved
Hide resolved
src/System Application/App/AI/src/Azure OpenAI/AOAIAuthorization.Codeunit.al
Outdated
Show resolved
Hide resolved
src/System Application/App/AI/src/Azure OpenAI/AOAIAuthorization.Codeunit.al
Show resolved
Hide resolved
src/System Application/App/AI/src/Azure OpenAI/AOAIAuthorization.Codeunit.al
Show resolved
Hide resolved
…uggable, Updated table name with spaces
src/System Application/App/AI/src/Azure OpenAI/AOAIAccountVerificationLog.Table.al
Outdated
Show resolved
Hide resolved
src/System Application/App/AI/src/Azure OpenAI/AOAIAuthorization.Codeunit.al
Show resolved
Hide resolved
src/System Application/App/AI/src/Azure OpenAI/AOAIAuthorization.Codeunit.al
Outdated
Show resolved
Hide resolved
src/System Application/App/AI/src/Azure OpenAI/AOAIAuthorization.Codeunit.al
Outdated
Show resolved
Hide resolved
src/System Application/App/AI/src/Azure OpenAI/AOAIAccountVerificationLog.Table.al
Outdated
Show resolved
Hide resolved
…cations, fixed minor issues with record fetching and saving
…ugging features removed.
src/System Application/App/AI/src/Azure OpenAI/AzureOpenAIImpl.Codeunit.al
Show resolved
Hide resolved
@@ -57,6 +77,19 @@ codeunit 7767 "AOAI Authorization" | |||
Deployment := NewDeployment; | |||
ApiKey := NewApiKey; | |||
ManagedResourceDeployment := NewManagedResourceDeployment; | |||
MicrosoftManagedAuthorizationWithDeployment := true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other overload of SetMicrosoftManagedAuthorization is now unused after the function in the other codeunit is removed.
So you need to wrap the old overload of SetMicrosoftManagedAuthorization into
#if not CLEAN26
<old overload>
#endif
end | ||
else | ||
if MicrosoftManagedAuthorizationWithDeployment then | ||
exit(AzureOpenAiImpl.IsTenantAllowlistedForFirstPartyCopilotCalls()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change, we are no longer checking anywhere that the variables are not empty.
I suggest we don't add the 4 new booleans at all, and instead we rely on the existence of account name or not (for example).
Example pseudo-code:
Enum::"AOAI Resource Utilization"::"Microsoft Managed":
if (AOAIAccountName <> '') and (ManagedResourceDeployment <> '') and (not ApiKey.IsEmpty()) then
exit(VerifyAOAIAccount(AOAIAccountName, ApiKey) and AzureOpenAiImpl.IsTenantAllowlistedForFirstPartyCopilotCalls())
else
exit((Deployment <> '') and (Endpoint <> '') and (not ApiKey.IsEmpty()) and (ManagedResourceDeployment <> '') and AzureOpenAiImpl.IsTenantAllowlistedForFirstPartyCopilotCalls());
You could even go one step further and make sure the old verification code is cleaned up automatically after the obsoletion period has passed
Example pseudo-code:
#if CLEAN26
Enum::"AOAI Resource Utilization"::"Microsoft Managed":
exit((AOAIAccountName <> '') and (ManagedResourceDeployment <> '') and (not ApiKey.IsEmpty()) and VerifyAOAIAccount(AOAIAccountName, ApiKey) and AzureOpenAiImpl.IsTenantAllowlistedForFirstPartyCopilotCalls());
#else
Enum::"AOAI Resource Utilization"::"Microsoft Managed":
if (AOAIAccountName <> '') and (ManagedResourceDeployment <> '') and (not ApiKey.IsEmpty()) then
exit(VerifyAOAIAccount(AOAIAccountName, ApiKey) and AzureOpenAiImpl.IsTenantAllowlistedForFirstPartyCopilotCalls())
else
exit((Deployment <> '') and (Endpoint <> '') and (not ApiKey.IsEmpty()) and (ManagedResourceDeployment <> '') and AzureOpenAiImpl.IsTenantAllowlistedForFirstPartyCopilotCalls());
#endif
if VerificationLog.Get(TruncatedAccountName) then | ||
RemainingGracePeriod := GracePeriod - (CurrentDateTime - VerificationLog.LastSuccessfulVerification) | ||
else | ||
RemainingGracePeriod := GracePeriod; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is no entry in verification log, then the remaining grace period should be 0.
It means that azure account was never verified and hence they are not entitled to grace period.
Fixes AB#535826